home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
19.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-17
|
639b
|
24 lines
/*
There may be additional include files required depending
upon the compile product you are using. Typical compilers
include Microsoft C by Microsoft or Turbo C by Boland Int'l.
*/
#include <stdio.h>
main()
{
int y, n=07;
y= n&0177; /* y is 7 */
printf("y=%o\n",y);
y= n|0177; /* y is 0177 */
printf("y=%o\n",y);
y= n^0177; /* y is 0170 */
printf("y=%o\n",y);
y= n& ~0177; /* ~0177 is 0177600, y is 0 */
printf("y=0x%x\n",y);
y= n>>1; /* 000 111 shifted right 1 = 000 011 thus, y is 3 */
printf("y=0x%x\n",y);
y= n<<2; /* 000 111 shifted left 2 = 011 100 thus, y is 034 */
printf("y=0x%x\n",y);
}